package com.season.order.controller;

import com.reason.order.pojo.Order;
import com.season.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 陈正果
 * @date 2020/7/2 10:38
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    /**
     * 通过username查找order信息
     *
     * @param username 用户名
     * @return Order
     */
    @RequestMapping("/findByUsername")
    public Order findByUsername(@RequestParam String username) {
        return orderService.findByUsername(username);
    }

    /**
     * 通过id查找order
     *
     * @param id 订单id
     * @return Order
     */
    @RequestMapping("/findById")
    public Order findById(@RequestParam String id) {
        return orderService.findById(id);
    }
}
